import { queryGodCategoryZtreeAsyn } from '@/api/admin.api'

export const formOptions = [
  {
    label: '商品目录',
    type: 'cascader',
    key: 'catalog',
    span: 12,
    props: {
      placeholder: '请选择',
      clearable: true,
      props: {
        lazy: true,
        lazyLoad (node, resolve) {
          const nodeId = node.value ? node.value : ''
          queryGodCategoryZtreeAsyn(nodeId, '').then((res) => {
            const { level } = node
            const nodes = Array.from(res)
              .map(item => ({
                value: item.id,
                label: item.categoryName,
                leaf: level >= 2
              }))
            // 通过调用resolve将子节点数据返回，通知组件数据加载完成
            resolve(nodes)
          })
        }
      }
    }
  },
  {
    label: '扶贫商品',
    type: 'select',
    key: 'isAid',
    span: 6,
    props: {
      placeholder: '请选择'
    },
    options: [
      {
        label: '请选择',
        value: ''
      },
      {
        label: '否',
        value: false
      },
      {
        label: '是',
        value: true
      }
    ]
  },
  {
    label: '商品名称',
    type: 'input',
    key: 'goodsName',
    span: 6,
    props: {
      placeholder: '请输入商品名称'
    }
  },
  {
    label: '电商编号',
    type: 'input',
    key: 'sku',
    span: 6,
    props: {
      placeholder: '请输入电商编号'
    }
  },
  {
    label: '商品状态',
    type: 'select',
    key: 'goodsState',
    span: 6,
    props: {
      placeholder: '请选择'
    },
    options: [
      {
        label: '全部',
        value: ''
      },
      {
        label: '新提交',
        value: 'COMMIT'
      },
      {
        label: '审核通过',
        value: 'PASS'
      },
      {
        label: '退回修改',
        value: 'RETURN'
      },
      {
        label: '商品下架',
        value: 'DOWN'
      }
      // {
      //   label: '修改后提交',
      //   value: '5'
      // }
    ]
  }
]

export const btns = [
  // {
  //   title: '外网商品展示',
  //   icon: 'check',
  //   event: 'on-approved'
  // },
  // {
  //   title: '设施自营价',
  //   icon: 'back',
  //   event: 'on-set'
  // }
]
